\documentclass{book}
% \usepackage{nameref}
% \hypersetup{colorlinks}% uncomment this line if you prefer colored hyperlinks (e.g., for onscreen viewing)

\usepackage{hyphenat, xcolor, url, booktabs, amsmath, amssymb}
\usepackage[backend=biber, natbib=true, style=numeric]{biblatex}
\usepackage{xargs}
\usepackage{units}
\renewcommandx{\cite}[3][1={0pt},2={}]{\sidenote[][#1]{\fullcite[#2]{#3}}}
\usepackage{listings}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{almond}{rgb}{0.94, 0.87, 0.8}
\definecolor{antiquewhite}{rgb}{0.98, 0.92, 0.84}
\lstdefinestyle{mystyle}{ 
    commentstyle=\color{codegreen},
    keywordstyle=\color{magenta},
    backgroundcolor=\color{antiquewhite},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
}

\lstset{style=mystyle}


\usepackage{graphicx}
% \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{graphics/}}


% % The fancyvrb package lets us customize the formatting of verbatim
% % environments.  We use a slightly smaller font.
\usepackage{fancyvrb}
\fvset{fontsize=\normalsize}

% %%
% % Prints argument within hanging parentheses (i.e., parentheses that take
% % up no horizontal space).  Useful in tabular environments.
\newcommand{\hangp}[1]{\makebox[0pt][r]{(}#1\makebox[0pt][l]{)}}

% %%
% % Prints an asterisk that takes up no horizontal space.
% % Useful in tabular environments.
\newcommand{\hangstar}{\makebox[0pt][l]{*}}

% %%
% % Prints a trailing space in a smart way.
\usepackage{xspace}

% % Inserts a blank page
\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}

\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{0pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%
% Book metadata
\title{Building Production Recommendation Systems in Python,\\ and JAX!}
% \date{The edition number}
\author{Bryan Bischof, Hector Yee}
% \publisher{Publisher of This Book}


% %%
% % Some shortcuts for Tufte's book titles.  The lowercase commands will
% % produce the initials of the book title in italics.  The all-caps commands
% % will print out the full title of the book in italics.
% \newcommand{\vdqi}{\textit{VDQI}\xspace}
% \newcommand{\ei}{\textit{EI}\xspace}
% \newcommand{\ve}{\textit{VE}\xspace}
% \newcommand{\be}{\textit{BE}\xspace}
% \newcommand{\VDQI}{\textit{The Visual Display of Quantitative Information}\xspace}
% \newcommand{\EI}{\textit{Envisioning Information}\xspace}
% \newcommand{\VE}{\textit{Visual Explanations}\xspace}
% \newcommand{\BE}{\textit{Beautiful Evidence}\xspace}

% \newcommand{\TL}{Tufte-\LaTeX\xspace}

% Prints the month name (e.g., January) and the year (e.g., 2008)
% \newcommand{\monthyear}{%
%   \ifcase\month\or January\or February\or March\or April\or May\or June\or
%   July\or August\or September\or October\or November\or
%   December\fi\space\number\year
% }




% % Typesets the font size, leading, and measure in the form of 10/12x26 pc.
% \newcommand{\measure}[3]{#1/#2$\times$\unit[#3]{pc}}

% % Macros for typesetting the documentation
% \newcommand{\hlred}[1]{\textcolor{Maroon}{#1}}% prints in red
% \newcommand{\hangleft}[1]{\makebox[0pt][r]{#1}}
% \newcommand{\hairsp}{\hspace{1pt}}% hair space
% \newcommand{\hquad}{\hskip0.5em\relax}% half quad space
% \newcommand{\TODO}{\textcolor{red}{\bf TODO!}\xspace}
% \newcommand{\ie}{\textit{i.\hairsp{}e.}\xspace}
% \newcommand{\eg}{\textit{e.\hairsp{}g.}\xspace}
% \newcommand{\na}{\quad--}% used in tables for N/A cells
% \providecommand{\XeLaTeX}{X\lower.5ex\hbox{\kern-0.15em\reflectbox{E}}\kern-0.1em\LaTeX}
% \newcommand{\tXeLaTeX}{\XeLaTeX\index{XeLaTeX@\protect\XeLaTeX}}
% % \index{\texttt{\textbackslash xyz}@\hangleft{\texttt{\textbackslash}}\texttt{xyz}}
% \newcommand{\tuftebs}{\symbol{'134}}% a backslash in tt type in OT1/T1
% \newcommand{\doccmdnoindex}[2][]{\texttt{\tuftebs#2}}% command name -- adds backslash automatically (and doesn't add cmd to the index)
% \newcommand{\doccmddef}[2][]{%
%   \hlred{\texttt{\tuftebs#2}}\label{cmd:#2}%
%   \ifthenelse{\isempty{#1}}%
%     {% add the command to the index
%       \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2}}% command name
%     }%
%     {% add the command and package to the index
%       \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2} (\texttt{#1} package)}% command name
%       \index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}% package name
%     }%
% }% command name -- adds backslash automatically
% \newcommand{\doccmd}[2][]{%
%   \texttt{\tuftebs#2}%
%   \ifthenelse{\isempty{#1}}%
%     {% add the command to the index
%       \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2}}% command name
%     }%
%     {% add the command and package to the index
%       \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2} (\texttt{#1} package)}% command name
%       \index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}% package name
%     }%
% }% command name -- adds backslash automatically
% \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument
% \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument
% \newenvironment{docspec}{\begin{quotation}\ttfamily\parskip0pt\parindent0pt\ignorespaces}{\end{quotation}}% command specification environment
% \newcommand{\docenv}[1]{\texttt{#1}\index{#1 environment@\texttt{#1} environment}\index{environments!#1@\texttt{#1}}}% environment name
% \newcommand{\docenvdef}[1]{\hlred{\texttt{#1}}\label{env:#1}\index{#1 environment@\texttt{#1} environment}\index{environments!#1@\texttt{#1}}}% environment name
% \newcommand{\docpkg}[1]{\texttt{#1}\index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}}% package name
% \newcommand{\doccls}[1]{\texttt{#1}}% document class name
% \newcommand{\docclsopt}[1]{\texttt{#1}\index{#1 class option@\texttt{#1} class option}\index{class options!#1@\texttt{#1}}}% document class option name
% \newcommand{\docclsoptdef}[1]{\hlred{\texttt{#1}}\label{clsopt:#1}\index{#1 class option@\texttt{#1} class option}\index{class options!#1@\texttt{#1}}}% document class option name defined
% \newcommand{\docmsg}[2]{\bigskip\begin{fullwidth}\noindent\ttfamily#1\end{fullwidth}\medskip\par\noindent#2}
% \newcommand{\docfilehook}[2]{\texttt{#1}\index{file hooks!#2}\index{#1@\texttt{#1}}}
% \newcommand{\doccounter}[1]{\texttt{#1}\index{#1 counter@\texttt{#1} counter}}

% % Generates the index
% \usepackage{makeidx}
% \makeindex

% %%%% Kevin Godny's code for title page and contents from https://groups.google.com/forum/#!topic/tufte-latex/ujdzrktC1BQ
% \makeatletter
% \renewcommand{\maketitlepage}{%
% \begingroup%

% {\fontsize{24}{24}\selectfont\textit{\@author}\par}

% \vspace{1.75in}{\fontsize{36}{54}\selectfont\@title\par}

% \vspace{0.5in}{\fontsize{14}{14}\selectfont\textsf{\smallcaps{\@date}}\par}

% \vfill{\fontsize{14}{14}\selectfont\textit{\@publisher}\par}

% \thispagestyle{empty}
% \endgroup
% }
% \makeatother

% \titlecontents{part}%
%     [0pt]% distance from left margin
%     {\addvspace{0.25\baselineskip}}% above (global formatting of entry)
%     {\allcaps{Part~\thecontentslabel}\allcaps}% before w/ label (label = ``Part I'')
%     {\allcaps{Part~\thecontentslabel}\allcaps}% before w/o label
%     {}% filler and page (leaders and page num)
%     [\vspace*{0.5\baselineskip}]% after

% \titlecontents{chapter}%
%     [4em]% distance from left margin
%     {}% above (global formatting of entry)
%     {\contentslabel{2em}\textit}% before w/ label (label = ``Chapter 1'')
%     {\hspace{0em}\textit}% before w/o label
%     {\qquad\thecontentspage}% filler and page (leaders and page num)
%     [\vspace*{0.5\baselineskip}]% after
    
% %%%% End additional code by Kevin Godby


% Front matter
\frontmatter

% r.3 full title page
\maketitle

% v.4 copyright page
\newpage
% \begin{fullwidth}
% ~\vfill
% \thispagestyle{empty}
% Copyright \copyright\ \the\year\ \thanklessauthor

% \par\smallcaps{Published by \thanklesspublisher}

% \par\smallcaps{tufte-latex.googlecode.com}

% \par Licensed under the Apache License, Version 2.0 (the ``License''); you may not
% use this file except in compliance with the License. You may obtain a copy
% of the License at \url{http://www.apache.org/licenses/LICENSE-2.0}. Unless
% required by applicable law or agreed to in writing, software distributed
% under the License is distributed on an \smallcaps{``AS IS'' BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND}, either express or implied. See the
% License for the specific language governing permissions and limitations
% under the License.\index{license}

% \par\textit{First printing, \monthyear}
% \end{fullwidth}

% r.5 contents
\tableofcontents

% \listoffigures

% \listoftables


\chapter*{Preface}

How did you come to find this book? Did you see an ad for it on some website? Maybe a friend or instructor suggested it; or perhaps you saw a tweet referencing it. Could it be that you found it sitting on a shelf in a bookstore; a bookstore that your trusty maps app led you to. In any case, you’ve almost certainly come to this book via a recommendation system.

Implementing and designing systems to provide suggestions to users is among the most popular and most essential first applications of Machine Learning to any business. Whether you wish to help your users find the best clothing to their tastes, the most appealing items to buy from your online store, the videos to enrich and entertain them, maximally engaging content from their networks, or the news they need to know on that day, recommendation systems(often abbreviated RecSys) provide the way.

Modern recommendation system designs are as diverse as the fields in which they serve. Methods for recommending can come from traditional statistical learning algorithms, linear algebraic inspirations, geometric considerations, and, of course, gradient based methods. While the algorithmic methods are diverse, so too are the statistical and evaluation considerations for recommending: personalized ranking, search recommendations, sequence modeling, and the scoring for all of the above are now need-to-know for the working ML Engineer in the space of recommendation systems.

As a practitioner, you’ll need to understand:
\begin{itemize}
    \item What are the essential data to get started building a RecSys
    \item How to take your data and business problem, and frame it as a RecSys problem
    \item What are the appropriate models for your RecSys problem and how should you evaluate them
    \item How to implement, train, test, and deploy the aforementioned model
    \item What metrics you should be tracking to ensure your system is working as planned
    \item How to incrementally improve your system as you learn more about your users, products, and business case
\end{itemize}

This book seeks to illustrate the core concepts and examples necessary to do the above–whatever the industry or scale. In this book we guide the reader through the math, ideas, and implementation details of your first or fiftieth recommendation system. We illustrate how to build these systems with Python and JAX.

% r.9 introduction
\cleardoublepage

%%
% Start the main matter (normal chapters)
% \mainmatter

\part{The Warmup}

\input{book-text/CH0-Warmup}

\input{book-text/CH1-User-Item}

\input{book-text/CH2-Math-considerations}

\input{book-text/CH3-System-Design}

\part{Retrieval}

% \backmatter

% \bibliographystyle{plainnat}


% \printindex

\end{document}
